<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<title>用户表单</title>
		<div th:replace="/common/common_form_header"></div>
		<script type="text/javascript">
			$(document).ready(function() {
				initSelect("orgDept","/system/org/dept/selectjson/0",$("#oldOrdDeptId").val());
				$('#defaultForm').bootstrapValidator({
		            message: 'This value is not valid',
		            feedbackIcons: {
		                valid: 'glyphicon glyphicon-ok',
		                invalid: 'glyphicon glyphicon-remove',
		                validating: 'glyphicon glyphicon-refresh'
		            },
		            fields: {
		            	userName: {
		                    validators: {
		                        notEmpty: {
		                            message: '中文名不能为空！'
		                        }
		                    }
		                } 
		            }
		        }).on('success.form.bv', function(e) {
		            // Prevent form submission
		            e.preventDefault();

		            // Get the form instance
		            var $form = $(e.target);

		            // Get the BootstrapValidator instance
		            var bv = $form.data('bootstrapValidator');

		            // Use Ajax to submit form data
		            $.post($form.attr('action'), $form.serialize(), function(result) {
		            	parent.layui.table.reload('dg_user');
						window.parent.layer.msg(result.msg);
						closeLayer();
		            }, 'json');
		        });
			});
		</script>
	</head>
	<body>
		<div class="building-details" id="building-details">
	    	<div class="layui-tab-content">
    			<form id="defaultForm" th:method="post" th:action="@{/system/org/user/update}">
	    			<div class="form-modal">
						<div class="form-wrap clearfix">
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">所属组织</label>
								    <select id="orgDept" name="orgDept" class="form-control selectpicker">
								   	</select>
								</div>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">排序号</label>
								    <input th:value="${model.sortNumber}" type="text" name="sortNumber" class="form-control" placeholder="">
								</div>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">登录名</label>
								    <input th:value="${model.userid}" readonly type="text" name="userid" id="userid" class="form-control"  placeholder="请填写登录名">
								</div>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">中文名</label>
								    <input th:value="${model.userName}" type="text" name="userName" id="userName" class="form-control"  placeholder="请填写用户中文名">
								</div>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">手机号</label>
								    <input th:value="${model.phoneNumber}" type="text" name="phoneNumber" id="phoneNumber" class="form-control"  >
								</div>
							</div>
							<div class="col-md-6 col-sm-6 col-xs-6">
								<div class="form-group">
								    <label for="">电子邮件</label>
								    <input th:value="${model.emailAddress}" type="text" name="emailAddress" id="emailAddress" class="form-control"  placeholder="如:abc@abc.com">
								</div>
							</div>
							
							<div class="col-md-6 col-sm-6 col-xs-6">
								<input type="hidden" name="id" id="id" th:value="${model.id}" />
								<input type="hidden" id="oldOrdDeptId" name="oldOrdDeptId" th:value="${model.orgDept!=null}?${model.orgDept.id}" />
								<button type="submit" class="btn btn-primary float-r">保存</button>
							</div>
						 	<div class="col-md-6 col-sm-6 col-xs-6">
								<button type="button" class="btn btn-default" onclick="closeLayer();">取消</button>
							</div>	
							
						</div>
					</div>
				</form>
    		</div>
    	</div>
	</body>
</html>